<!DOCTYPE html>
<html>
<head lang="en">
	<title>注册页 如梦技术——JFinal2.0 极速开发</title>
	<% include("include/_mate.html") {} %>
	<style>
		.header {
			text-align: center;
		}
		.header h1 {
			font-size: 200%;
			color: #333;
			margin-top: 30px;
		}
		.header p {
			font-size: 14px;
		}
		.blog-footer {
			padding: 10px 0;
			text-align: center;
		}
	</style>
</head>
<body>
<div class="header">
	<div class="am-g">
		<h1>如梦技术——<small>JFinal2.0 极速开发</small></h1>
	</div>
	<hr />
</div>
<div class="am-g">
	<div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
		<h3>注册</h3>
		<hr>
		<form method="post" action="${ctxPath}/ajax/register" class="am-form" data-am-validator>
			<div class="am-input-group">
				<span class="am-input-group-label"><i class="am-icon-envelope-o am-icon-fw"></i></span>
				<input type="email" name="email" class="am-form-field" placeholder="邮箱" required>
			</div>
			<br>
			<div class="am-input-group">
				<span class="am-input-group-label"><i class="am-icon-lock am-icon-fw"></i></span>
				<input type="password" name="password" class="am-form-field" placeholder="密码" required>
			</div>
			<br>
			<div class="am-input-group">
				<span class="am-input-group-label"><i class="am-icon-image am-icon-fw"></i></span>
				<input type="text" name="imgCode" class="am-form-field" placeholder="验证码" maxlength="4" required>
				<span class="am-input-group-btn">
					<img src="${ctxPath}/image_code" onclick="this.src = '${ctxPath}/image_code?v=' + Math.random()" height="38" style="border: 1px solid #ccc;border-left: 0;cursor: pointer;" />
				</span>
			</div>
			<br />
			<div class="am-cf">
				<input type="submit" value="注 册" class="am-btn am-btn-primary am-btn-sm am-btn-block am-fl">
			</div>
			<div class="am-cf">
				<a href="${ctxPath}/login?from=${c.encodeUrl(from)}" class="am-fl">已有帐号，点击登录</a>
				<a href="${ctxPath}" class="am-fr">忘记密码 ^_^ ?</a>
			</div>
		</form>
	</div>
</div>

<footer class="blog-footer">
	<p>blog template<br/>
		<small>© Copyright XXX. by the AmazeUI Team.</small>
	</p>
</footer>

<% include("include/_script.html") {} %>
<script type="text/javascript">
	$(function(){
		$("form").submit(function(){
			var $form = $(this);
			$.post($form.attr("action"), $form.serialize(), function(data){
				if (data.code === 0) {
					layer.msg("注册成功", {shift: 1});
					setTimeout(function(){window.location.href = "${ctxPath}/login?from=${c.encodeUrl(from)}";}, 1200);
					return false;
				} else {
					layer.msg(data.message, {shift: 6});
					return false;
				}
			}, "json");
			return false;
		});
	});
</script>
</body>
</html>